<template>
  <div class="mui-numbox" data-numbox-min="1" style="height:25px">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      id="test"
      class="mui-input-numbox"
      type="number"
      :value="initCount"
      ref="inp"
      @change="countChange"
    />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>

<script>
import mui from "../../lib/mui/js/mui.js";
import { mapMutations } from "vuex";

export default {
  data() {
    return {};
  },
  methods: {
    ...mapMutations(['upDateCart']),
    countChange() {
      let val = this.$refs.inp.value;
      console.log(val);
      
      this.upDateCart({id:this.id,count:parseInt(val)})
    }
  },
  mounted() {
    mui(".mui-numbox").numbox();
  },
  props:['initCount',"id"]
};
</script>

<style>
</style>